$(function () {
    let imgElemList = $("a[href='#']")
    console.log(imgElemList)
    imgElemList.each(function (index, elem) {
        console.log($(this))
        console.log($(this).attr("title"))
        let eachTitle = $(this).attr("title")
        if (eachTitle && eachTitle.indexOf("广告") > -1) {
            console.log($(this).parent("div"))

            let eachParentElem = $(this).parent("div")
            while (eachParentElem && eachParentElem.length > 0) {
                console.log('while循环')
                eachParentElem.css("display", "none")
                eachParentElem = eachParentElem.parent("div")
            }
        }
        if (eachTitle && eachTitle.indexOf("美百") > -1) {
            console.log($(this).parent("div"))

            let eachParentElem = $(this).parent("div")
            while (eachParentElem && eachParentElem.length > 0) {
                console.log('while循环')
                eachParentElem.css("display", "none")
                eachParentElem = eachParentElem.parent("div")
            }
        }
    })
})